import allure
import pytest,requests
from selenium import webdriver
@pytest.fixture(scope='function')
def login():
    url = 'http://10.59.9.18/movieApi/user/v2/login'
    data = {
        'email': '1478997572@qq.com',
        'pwd': 'eWLPHopE945d2ivttHaQTQ=='
    }

    login = requests.post(url=url, data=data)
    login_json = login.json()
    print(login_json)
    print(login_json['result']['sessionId'], login_json['result']['userId'])
    return login_json['result']['sessionId'], login_json['result']['userId']

@pytest.fixture(scope='function')
def driver():
    driver = webdriver.Edge()
    driver.maximize_window()
    driver.implicitly_wait(10)
    yield driver
    driver.close()
    driver.quit()
    allure.attach.file(
        r'C:\Users\20176\Desktop\yue_mo\logs\rizhi.log',
        name='rizhi111.log',
        attachment_type=allure.attachment_type.TEXT
    )